home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 15
/
Aminet 15 - Nov 1996.iso
/
Aminet
/
disk
/
cdrom
/
Atapi_PnP300.lha
/
atapi_pnp300
/
developer_kit
/
PlayMSF.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-04
|
3KB
|
98 lines
/****************************************************************************
*
*
* $VER: PlayMSF.c 1.0 (22 Jan 1996) by M_Campinoti CD++
*
* $HISTORY:
*
* 22 Jan 1996 : 001.000 : First and Last release of an example that show
* how to play audio tracks by means of
* CD_PLAYMSF command.
* Didactical use, so CLI only :)
*
****************************************************************************/
#include <proto/exec.h>
#include <exec/devices.h>
#include <exec/io.h>
#include <stdio.h>
#include <stdlib.h>
#include "atapi_cd.h"
/* minutes,seconds,frames to play (default 1m,1sec,1fr) */
main (UBYTE argc,UBYTE** argv)
{
struct IOStdReq *ioreq ;
struct MsgPort *reply ;
ULONG m_start,f_start,s_start;
ULONG m_len,f_len,s_len;
ULONG start , length ;
f_len = 0 ;
s_len = 0 ;
switch(argc)
{
case 0:
return; /* it came from workbench .... */
break;
default:
case 1:
case 2:
case 3:
case 4:
printf("USAGE: PlayMSF startM startS startF lenM lenS lenF\n \
Example: PlayMSF 0 2 0 1 2 3");
return; /* Yes, this isn't a cool template, but is quickly ! (i'm lazy) */
case 7:
f_len = atoi(argv[6]);
case 6:
s_len = atoi(argv[5]);
case 5:
m_len = atoi(argv[4]);
f_start = atoi(argv[3]);
s_start = atoi(argv[2]);
m_start = atoi(argv[1]);
break;
}
start = (m_start<<16) | (s_start<<8) | f_start ;
length = (m_len <<16) | (s_len <<8) | f_len ;
if( reply = CreateMsgPort() )
{
if( ioreq = (struct IOStdReq *)
CreateIORequest(reply ,sizeof(struct IOStdReq)) )
{
if(!OpenDevice("cd.device",0,(struct IORequest*)ioreq,NULL) )
{
ioreq->io_Command = CD_PLAYMSF;
ioreq->io_Offset = start;
ioreq->io_Length = length;
printf("Start Playing at requested MSF ...\n");
DoIO((struct IORequest*)ioreq);
if (ioreq->io_Error)
printf("I/O error !\n"); /* analyze ioreq->io_Error to know what kind ... */
/* ... see atapi_cd.h for #defines of it ! */
CloseDevice((struct IORequest *)ioreq) ;
}
DeleteIORequest(ioreq) ;
}
DeleteMsgPort(reply);
}
}